const Router = require('koa-router'),
	mongoose = require('mongoose')

let router = new Router()

router.post('/getSubCateListByCateId', async ctx => {
	try {
		const SubCategory = mongoose.model('SubCategory'),
			cateId = ctx.request.body.cateId,
			result = await SubCategory.find({ MALL_CATEGORY_ID: cateId }).exec()

		ctx.body = {
			code: 200,
			message: result
		}
	} catch (error) {
		ctx.body = {
			code: 500,
			message: error
		}
	}
})

module.exports = router
